package com.example.hello;

import com.example.hello.client.CellTable.BootstrapCellTableRpc;
import com.example.hello.client.CellTable.BootstrapCellTableState;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.ui.AbstractComponent;

import java.util.HashMap;
import java.util.List;

public class BootstrapCellTable extends AbstractComponent {

    private BootstrapCellTableRpc rpc = new BootstrapCellTableRpc() {
        @Override
        public void click(MouseEventDetails mouseEventDetails, String name) {
            fireEvent(new BootstrapEvent(BootstrapCellTable.this));
        }
    };

    public BootstrapCellTable() {
        registerRpc(rpc);
    }

    public BootstrapCellTableState getState() {
        return (BootstrapCellTableState) super.getState();
    }

    public void setRows(List<HashMap<String, String>> rows) {
        getState().setRows(rows);
    }

    public List<HashMap<String, String>> getRows() {
        return getState().getRows();
    }

    public void setColumnProperties(List<String> columnProperties) {
        getState().setColumnPropertyNames(columnProperties);
    }

    public int getColumnCount() {
        return getState().columnCount;
    }

    public boolean isBordered() {
        return getState().isBordered();
    }

    public void setCondensed(boolean condensed) {
        getState().setCondensed(condensed);
    }

    public boolean isCondensed() {
        return getState().isCondensed();
    }

    public void setBordered(boolean bordered) {
        getState().setBordered(bordered);
    }

    public boolean isStriped() {
        return getState().isStriped();
    }

    public void setStriped(boolean striped) {
        getState().setStriped(striped);
    }

    public boolean isHovered() {
        return getState().isHovered();
    }

    public void setHovered(boolean hovered) {
        getState().setHovered(hovered);
    }

}
